package com.rahwi.rahwi_server.Handler;

import com.rahwi.rahwi_server.vo.results.ActionResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName ExceptionHandler
 * @Description Controller层异常的AOP统一处理
 * @Date 2021/12/11 17:19
 * @Autor mjw
 * @Version 1.0
 */
@ControllerAdvice
public class ControllerExceptionHandler {


    @ExceptionHandler(Exception.class)
    @ResponseBody
    public ActionResult dealException(Exception e){
        //写入日志
        e.printStackTrace();
        return ActionResult.fail(500,"内部异常");
    }
}
